<HTML>
<HEAD>
  <STYLE type="text/css">
    H1 {color: black }
    H2 {color: maroon }
    H3 {color: #007090 }
    A.head:link {color: #0060a0 }
    A.head:visited {color: #3040c0 }
    A.head:active {color: white }
    A.head:hover {color: yellow }
    A.red:link {color: red }
    A.red:visited {color: maroon }
    A.red:active {color: yellow }
  </STYLE>
</HEAD>
<TITLE>Magic-8.3 Command Reference</TITLE>
<BODY BACKGROUND=graphics/blpaper.gif>
<H1> <IMG SRC=graphics/magic_title8_3.png ALT="Magic VLSI Layout Tool Version 8.3">
     <IMG SRC=graphics/magic_OGL_sm.gif ALIGN="top" ALT="*"> </H1>

<H2>flatten</H2>
<HR>
Flatten edit cell into the indicated destination cell.
<HR>

<H3>Usage:</H3>
   <BLOCKQUOTE>
      <B>flatten</B> [<I>option</I>] <I>cellname</I> <BR><BR>
      <BLOCKQUOTE>
         where <I>cellname</I> is the name of a cell definition to be
	 created, and into which the flattened geometry will be placed.
	 <I>option</I> may be one of <B>-nolabels</B>, <B>-nosubcircuits</B>,
	 or <B>-noports</B>, <B>-novendor</B>, <B>-dotoplabels</B>,
	 <B>-doproperty</B>, and <B>-dobox</B>.
      </BLOCKQUOTE>
   </BLOCKQUOTE>

<H3>Summary:</H3>
   <BLOCKQUOTE>
      The <B>flatten</B> command creates a new cell with the indicated
      name, then flattens the hierarchy of the current edit cell and
      copies the result into the new cell. <P>

      The options allow selective flattening, as follows:
      <DL>
        <DT> <B>-nolabels</B>
        <DD> Prevents magic from copying labels into the flattened cell.
	     Otherwise, magic flattens labels by prepending the cell
	     hierarchy to each label as it copies it into the flat cell.
        <DT> <B>-nosubcircuits</B>
	<DD> Prevents magic from flattening cells declared to be subcircuits
	     (by the presence of ports in the cell).  These cells are
	     retained as subcells in the flattened version.
        <DT> <B>-noports</B>
	<DD> Removes port information from labels when flattening, so that
	     the flattened view will have only labels and not ports.
        <DT> <B>-novendor</B>
	<DD> Prevents magic from flattening cells that are vendor cells,
	     that is, cells that are generated by reading GDS using the
	     <B>gds readonly</B> option, or which have the appropriate
	     property values set.
        <DT> <B>-dotoplabels</B>
	<DD> This option tells magic to preserve in the flattened view
	     only the labels that are in the top level cell.  Labels in
	     subcells will be ignored.
        <DT> <B>-doproperty</B>
	<DD> This option will only flatten subcells which are marked
	     with the property string "<B>flatten</B>".  This is useful
	     for flattening an entire set of cells;  for example, flattening
	     subcells with routing before creating a DEF file of a layout.
        <DT> <B>-dobox</B>
	<DD> When this option is specified, magic flattens only the area
	     of the circuit that is inside the boundary of the cursor box.
        <DT> <B>-doinplace</B>
	<DD> When this option is specified, <I>cellname</I> must be the
	     name of a cell <I>use</I> (instance), not a cell <I>definition</I>.
	     The cell use <I>cellname</I> is assumed to exist in the current
	     edit cell.  The cell use will be removed from the edit cell and
	     replaced with its flattened contents.
      </DL>

      Note that <I>cellname</I> is a top-level cell but is not displayed
      or saved subsequent to the <B>flatten</B> command.  The usual
      procedure is to follow the command "<B>flatten</B> <I>cellname</I>"
      with "<B>load</B> <I>cellname</I>", to view the new flattened
      layout.  <P>

      The target cell <I>cellname</I> must not already exist in the
      database except when using the <B>-dobox</B> option.  With <B>-dobox</B>,
      using the same target <I>cellname</I> allows a layout to be flattened
      in pieces. <P>

   </BLOCKQUOTE>

<H3>Implementation Notes:</H3>
   <BLOCKQUOTE>
      <B>flatten</B> is implemented as a built-in command in <B>magic</B>.
   </BLOCKQUOTE>

<P><IMG SRC=graphics/line1.gif><P>
<TABLE BORDER=0>
  <TR>
    <TD> <A HREF=commands.html>Return to command index</A>
  </TR>
</TABLE>
<P><I>Last updated:</I> June 23, 2021 at 5:48pm <P>
</BODY>
</HTML>
